package com.neu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neu.entity.ProjectUserRole;
import com.neu.mapper.ProjectUserRoleMapper;
import com.neu.service.ProjectUserRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectUserRoleServiceImpl extends ServiceImpl<ProjectUserRoleMapper, ProjectUserRole> implements ProjectUserRoleService {
    @Override
    public List<ProjectUserRole> getRoleIdsByUserId(String userId) {
        LambdaQueryWrapper<ProjectUserRole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ProjectUserRole::getUserId, userId);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<ProjectUserRole> findByProjectId(String projectId) {
        LambdaQueryWrapper<ProjectUserRole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ProjectUserRole::getProjectId, projectId);
        return this.list(queryWrapper);
    }
}
